{extend name="public:base"/}
{block name="main"}

<form class="layui-form" action="" method="POST" lay-filter="form">
  <div class="layui-form-item">
    <label class="layui-form-label"><span class="form-required">*</span>作者名称</label>
    <div class="layui-input-inline ">
      <input type="hidden" name="authorid" value="">
      <input type="text" name="name" lay-verify="required"  placeholder="请输入作者名称" autocomplete="off" class="layui-input" value="">
    </div>
  </div>
  <div class="layui-form-item">
     <label class="layui-form-label">缩略图</label>
     <div class="layui-input-inline  width-350" >
       <input type="text" name="pic"  placeholder="头像图片地址" autocomplete="off" class="layui-input"  value="">
       
     </div>
     <div class="layui-word-aux">

       <img src="" class="content-photos" id="pic">
        
       <button type="button" class="layui-btn layui-btn-small layui-btn-normal fileupload" id="fileupload">
         <i class="layui-icon">&#xe60d;</i>上传头像
       </button>
     </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">排序</label>
    <div class="layui-input-inline">
      <input type="number" name="px"  placeholder="请输入数字排序" autocomplete="off" class="layui-input" value="">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">状态</label>
    <div class="layui-input-block">
      <input type="checkbox" name="status" lay-skin="switch" lay-text="启用|禁用" lay-filter="switchTest" value="1" checked >
      <div class="layui-unselect layui-form-switch" lay-skin="_switch">
        <em>OFF</em><i></i>
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="submit">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>

<script type="text/javascript">
	layui.use(['form','upload','table'], function(){
    
    form = layui.form;
    upload=layui.upload;
    table=layui.table;

    obj = {
      url: '{:Url('common/fileupload',array('width'=>"60",'height'=>"60",'nowater'=>'1'))}',
      inc: function(res){
          $("input[name='pic']").val(res.path);
          $(".content-photos").attr("src",res.path);
      }
    };
    
    admin.fileupload(obj);

    admin.init(['edit','submit']);
    

	 
	});
</script>

{/block}